<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: lijincheng
  Date: 2021/4/1
  Time: 17:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link href="${pageContext.request.contextPath}/css/boot3/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/index.css">
    <link href="${pageContext.request.contextPath}/css/user/login.css" rel="stylesheet" type="text/css">
    <script src="${pageContext.request.contextPath}/js/jquery-3.5.1.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/js/user/login.js" type="text/javascript"></script>
    <style>

    </style>
</head>
<body>
<div class="header_top">
    <div class="container">
        <div class="header_top-box">
            <div class="cssmenu" style="float: left">
                <ul>
                    <c:choose>
                        <c:when test="${sessionScope.user == null}">
                            <li><a id="onload-login" href="javascript:void(0)">亲，请登录</a></li>
                            <li><a href="${pageContext.request.contextPath}/register/index">免费注册</a></li>
                        </c:when>
                        <c:otherwise>
                            <li><a href="#">欢迎 ${sessionScope.user.getUName()}</a></li>
                        </c:otherwise>
                    </c:choose>
                </ul>
                <div class="clearfix"></div>
            </div>
            <div class="cssmenu">
                <ul>
                    <c:if test="${sessionScope.user != null}">
                        <c:set var="u" value="${sessionScope.user}"/>
                        <li><a href="/ubook/post/index">发布记录</a></li>
                        <li><a href="/user/person/index">个人中心</a></li>
                        <li><a href="/user/shop/car/${u.getId()}/index">购物车</a></li>
                        <li><a href="/login/out">退出登录</a></li>
                    </c:if>
                </ul>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>
<div class="header_bottom">
    <div class="container">
        <div class="header_bottom-box">
            <div class="header_bottom_left">
                <div class="logo">
                    <a href="/index"><img src="/images/e.png" alt=""/></a>
                </div>
                <ul class="clock">
                    <i class="clock_icon"> </i>
                    <li class="clock_desc" id="time"></li>
                </ul>
                <div class="clearfix"> </div>
            </div>
            <div class="header_bottom_right">
                <div class="search">
                    <input type="text" >
                    <input type="submit" value="">
                </div>
                <ul class="bag">
                    <a href="#"><i class="bag_left"> </i></a>
                    <a href="#"><li class="bag_right"><p>205.00 $</p> </li></a>
                    <div class="clearfix"> </div>
                </ul>
            </div>
            <div class="clearfix"> </div>
        </div>
    </div>
</div>
<hr>
<div class="content_top">
    <div class="container">
        <div class="grid_2">
            <div class="col-md-3 span_6">
                <div class="box_inner">
                    <img src="/images/p1.jpg" class="img-responsive" alt=""/>
                    <div class="sale-box"> </div>
                    <div class="desc">
                        <h3>Ullamcorper suscipit</h3>
                        <h4>178,90 $</h4>
                        <ul class="list2">
                            <li class="list2_left"><span class="m_1"><a href="#" class="link">Add to Cart</a></span></li>
                            <li class="list2_right"><span class="m_2"><a href="#" class="link1">See More</a></span></li>
                            <div class="clearfix"> </div>
                        </ul>
                        <div class="heart"> </div>
                    </div>
                </div>
            </div>
            <div class="col-md-3 span_6">
                <div class="box_inner">
                    <img src="/images/p2.jpg" class="img-responsive" alt=""/>
                    <div class="sale-box"> </div>
                    <div class="desc">
                        <h3>Ullamcorper suscipit</h3>
                        <h4>178,90 $</h4>
                        <ul class="list2">
                            <li class="list2_left"><span class="m_1"><a href="#" class="link">Add to Cart</a></span></li>
                            <li class="list2_right"><span class="m_2"><a href="#" class="link1">See More</a></span></li>
                            <div class="clearfix"> </div>
                        </ul>
                        <div class="heart"> </div>
                    </div>
                </div>
            </div>
            <div class="col-md-3 span_6">
                <div class="box_inner">
                    <img src="/images/p3.jpg" class="img-responsive" alt=""/>
                    <div class="sale-box"> </div>
                    <div class="desc">
                        <h3>Ullamcorper suscipit</h3>
                        <h4>178,90 $</h4>
                        <ul class="list2">
                            <li class="list2_left"><span class="m_1"><a href="#" class="link">Add to Cart</a></span></li>
                            <li class="list2_right"><span class="m_2"><a href="#" class="link1">See More</a></span></li>
                            <div class="clearfix"> </div>
                        </ul>
                        <div class="heart"> </div>
                    </div>
                </div>
            </div>
            <div class="col-md-3 span_6">
                <div class="box_inner">
                    <img src="/images/p4.jpg" class="img-responsive" alt=""/>
                    <div class="sale-box"> </div>
                    <div class="desc">
                        <h3>Ullamcorper suscipit</h3>
                        <h4>178,90 $</h4>
                        <ul class="list2">
                            <li class="list2_left"><span class="m_1"><a href="#" class="link">Add to Cart</a></span></li>
                            <li class="list2_right"><span class="m_2"><a href="#" class="link1">See More</a></span></li>
                            <div class="clearfix"> </div>
                        </ul>
                        <div class="heart"> </div>
                    </div>
                </div>
            </div>
            <div class="clearfix"> </div>
        </div>
    </div>
</div>

<div class="login">
    <div class="login-title">登录易书城<span><a href="javascript:void(0);" class="close-login">关闭</a></span></div>
    <div class="login-input-content">
        <div class="login-input">
            <label>账&nbsp;&nbsp;&nbsp;&nbsp;号：</label>
            <input type="text" placeholder="请输入手机号或邮箱"  name="info[username]" id="username" class="list-input"/>
        </div>
        <div class="login-input">
            <label>登录密码：</label>
            <input type="password" placeholder="请输入登录密码" name="info[password]" id="password" class="list-input"/>
        </div>
        <div class="login-input">
            <label>验&nbsp;证&nbsp;&nbsp;码：</label>
            <input type="text" placeholder="请输入验证码" id="code" style="width: 12em" class="list-input"/>
            <img style="margin-left: 2em" id="imgVerify" src="" width="105px" height="35px" alt="点击更换验证码" onclick="getVerify()"/>
        </div>
        <div class="login-input" style="font-size: 1em">
            <input type="radio" style="margin-left: 10%;vertical-align: center" name="remeberMe" value="1"/> <span style="font-size: 1.2em">记住我</span>
        </div>
    </div>
    <div class="login-button"><a href="javascript:void(0);" id="login-button-submit">登录会员</a></div>
</div>

<div class="login-bg"></div>
<script>
    $(document.body).ready(function () {
        $("#imgVerify").attr("src", "/getVerify?" + Math.random());
        var now = new Date();
        var time = now.getFullYear()+'-'+((now.getMonth()+1)<10?"0":"")+(now.getMonth()+1)+"-"+(now.getDate()<10?"0":"")+now.getDate();
        console.log(time);
        $("#time").text(time);

        $.ajax({
            type: "POST",
            url: "/user/getCookie",
            success: function (data) {
                console.log(data);
                $("#account").val(data.uemail);
                $("#pass").val(data.upass);
            },
            error:function (){
                alert("信息获取失败")
            }
        });
    });



    function getVerify() {
        var s = document.getElementById('imgVerify');
        s.src = "/getVerify?" + Math.random();
    }


</script>
</body>
</html>
